﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace scrumbench
{
    public partial class MainMenuForm : Form
    {
        public MainMenuForm()
        {
            InitializeComponent();
        }

        public MainMenuForm(string username, int userid, string name, string firstname, string role)
        {
            InitializeComponent();
            
            this.userid = userid.ToString();
            this.uname = username;
            this.name = name;
            this.firstname = firstname;
            this.role = role;



        }


        private string role;

        public string Role
        {
            get { return role; }
            set { role = value; }
        }

        private string uname;

        public string Uname
        {
            get { return uname; }
            set { uname = value; }
        }


        private string userid;

        public string Userid
        {
            get { return userid; }
            set { userid = value; }
        }


        private string name;

        public string Name1
        {
            get { return name; }
            set { name = value; }
        }

        private string firstname;

        public string Firstname
        {
            get { return firstname; }
            set { firstname = value; }
        }



        private void MainMenuForm_Load(object sender, EventArgs e)
        {
            this.TBxUname.Text = uname;
            this.TBxUname.ReadOnly = true;
            this.TBxUID.Text = this.userid;
            this.TBxUID.ReadOnly = true;
            this.TBxName.Text = name + ", " + firstname;
            this.TBxName.ReadOnly = true;
            this.lblRole.Text = role;

            //Filter the buttons that can be shown, Admins and Stakeholders have different views/options
            if (role == "Developer")
            {
                BtManageUsers.Enabled = false;
                //BtManageProducts.Enabled = false;

            }
            else if (role == "Stakeholder")
            {
                BtMyView.Enabled = false;
                BtManageUsers.Enabled = false;
                //BtManageProducts.Enabled = false;
            }


        }

        private void BtManageProducts_Click(object sender, EventArgs e)
        {
            ManageProductsForm nManageProdForm = new ManageProductsForm(int.Parse(userid), role);
            nManageProdForm.Show();
        }

        private void BtManageTeams_Click(object sender, EventArgs e)
        {
            ManageUsersForm nManageUsersForm = new ManageUsersForm(uname, int.Parse(userid),name,firstname);
            nManageUsersForm.Show();
        }

        private void BtImpediments_Click(object sender, EventArgs e)
        {
            ImpedimentsLibraryForm nImpedimentsForm = new ImpedimentsLibraryForm();
            nImpedimentsForm.Show();
        }

        private void BtMyView_Click(object sender, EventArgs e)
        {
            MyViewForm nmyviewform = new MyViewForm(int.Parse(userid));
            if (!nmyviewform.IsAccessible)
            {
                nmyviewform.Show();
            }
        }

        private void panel5_Paint(object sender, PaintEventArgs e)
        {

        }

        private void xitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }


    }
}
